package com.gc.business.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gc.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import com.gc.business.mapper.ElevatorModelMapper;
import com.gc.business.domain.ElevatorModel;
import com.gc.business.service.IElevatorModelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;

/**
 * 电梯型号 服务层实现
 * 
 * @author 刘锦腾
 * @date 2020-12-08
 */
@Slf4j
@Service
public class ElevatorModelServiceImpl extends ServiceImpl<ElevatorModelMapper, ElevatorModel> implements IElevatorModelService {

    @Override
    public List<ElevatorModel> list(ElevatorModel elevatorModel){
        LambdaQueryWrapper<ElevatorModel> wrapper = new LambdaQueryWrapper<>();
        if(elevatorModel != null){
            if(StringUtils.isNotEmpty(elevatorModel.getModelId())){
                wrapper.eq(ElevatorModel::getModelId, elevatorModel.getModelId());
            }
            if(StringUtils.isNotEmpty(elevatorModel.getBrandId())){
                wrapper.eq(ElevatorModel::getBrandId, elevatorModel.getBrandId());
            }
            if(StringUtils.isNotEmpty(elevatorModel.getCompanyId())){
                wrapper.eq(ElevatorModel::getCompanyId, elevatorModel.getCompanyId());
            }
            if(StringUtils.isNotEmpty(elevatorModel.getModelName())){
                wrapper.like(ElevatorModel::getModelName, elevatorModel.getModelName());
            }
            if(StringUtils.isNotEmpty(elevatorModel.getBrandName())){
                wrapper.like(ElevatorModel::getBrandName, elevatorModel.getBrandName());
            }
            if(StringUtils.isNotEmpty(elevatorModel.getCreateBy())){
                wrapper.eq(ElevatorModel::getCreateBy, elevatorModel.getCreateBy());
            }
            if(StringUtils.isNotEmpty(elevatorModel.getCreateTime())){
                wrapper.eq(ElevatorModel::getCreateTime, elevatorModel.getCreateTime());
            }
            if(StringUtils.isNotEmpty(elevatorModel.getUpdateBy())){
                wrapper.eq(ElevatorModel::getUpdateBy, elevatorModel.getUpdateBy());
            }
            if(StringUtils.isNotEmpty(elevatorModel.getUpdateTime())){
                wrapper.eq(ElevatorModel::getUpdateTime, elevatorModel.getUpdateTime());
            }
            if(StringUtils.isNotEmpty(elevatorModel.getRemark())){
                wrapper.eq(ElevatorModel::getRemark, elevatorModel.getRemark());
            }
        }
        return baseMapper.selectList(wrapper);
    }

    /**
     * 公司数据权限查询
     * @param elevatorModel
     * @return
     */
    @Override
    public List<ElevatorModel> selectElevatorModelList(ElevatorModel elevatorModel){
        return baseMapper.selectElevatorModelList(elevatorModel);
    }

}
